-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: refactor to use mapping in cluster master #36250
Conversation
b98515a
to
f8fd5a1
Compare
lib/internal/cluster/master.js
Outdated
else if (message.act === 'close') | ||
close(worker, message); | ||
else if (fn) | ||
fn(worker, message); | ||
} | ||
|
||
function online(worker) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we just added message
to the signature here (to appease V8's JIT) and then treated online()
as the same as the other methods in onmessage()
to simplify things completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense actually 👍 reason for not doing this was the second argument passed will be unused, so if it is not of concern i can make the changes.
f8fd5a1
to
9e6defb
Compare
9e6defb
to
3acfccb
Compare
@yashLadha can you rebase to fix the conflict please? |
3acfccb
to
452491f
Compare
Cluster master message handler is basically doing the same thing for different message actions which can be avoided. Thus move to method mapping object and doing a single lookup to find the function to execute and it doesnot exists, skip the execution chain. PR-URL: nodejs#36250 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
452491f
to
88d8dde
Compare
Landed in 88d8dde |
Cluster master message handler is basically doing the same thing for different message actions which can be avoided. Thus move to method mapping object and doing a single lookup to find the function to execute and it doesnot exists, skip the execution chain. PR-URL: #36250 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes